<?php
/**
 * 编写者：Jayson
 * 编写日期：2024-06-12 15:41:55
 */

use App\Http\Controllers\admin\applet\LoginController;
use App\Http\Controllers\admin\notice\NewsController;
use App\Http\Controllers\admin\product\MountCourseController;
use App\Http\Controllers\admin\product\OrderController;
use App\Http\Controllers\admin\product\ProductController;
use App\Http\Controllers\admin\system\AdminUserController;
use App\Http\Controllers\admin\system\ConfigureController;
use App\Http\Controllers\admin\system\PermissionController;
use App\Http\Controllers\admin\system\RoleController;
use App\Http\Controllers\admin\system\StatisticsController;
use App\Http\Controllers\admin\system\UploadController;
use App\Http\Controllers\admin\users\RecordController;
use App\Http\Controllers\admin\users\UsersController;
use Illuminate\Support\Facades\Route;

/***************************************** 后端--start ****************************************/
Route::prefix('/admin')->group(function () {
    // 图片上传
    Route::post('upload/uploads_submit', [UploadController::class, 'uploadsSubmit']);
    // 获取登录验证码
    Route::get('/login/get_login_code', [LoginController::class, 'getLoginCode']);
    // 登录
    Route::post('/login/sign_in', [LoginController::class, 'signIn']);
    // 退出登录
    Route::post('/login/sign_out', [LoginController::class, 'signOut']);
});
Route::prefix('/admin')->middleware('check.permits')->group(function () {

    Route::middleware('admin.token')->group(function () {

        Route::prefix('system')->group(function () {
            // 管理员身份认证
            Route::post('system_login_auth', [LoginController::class, 'systemLoginAuth']);
            // 后台首页统计
            Route::post('get_home_statistics_data', [StatisticsController::class, 'getHomeStatisticsData']);
            // 后台用户信息
            Route::post('get_system_user_info', [AdminUserController::class, 'getSystemUserInfo']);
            // 后台用户修改密码
            Route::post('system_user_password_submit', [AdminUserController::class, 'systemUserPasswordSubmit']);

            // 获取管理员列表页面数据
            Route::get('get_admin_list_data', [AdminUserController::class, 'getAdminListData']);
            // 管理员表单提交
            Route::post('system_user_form_submit', [AdminUserController::class, 'systemUserFormSubmit']);
            // 获取角色列表页面数据
            Route::get('role/index', [RoleController::class, 'index']);
            //无需权限
            Route::get('role/select', [RoleController::class, 'select']);
            Route::post('role/add', [RoleController::class, 'add']);
            Route::post('role/edit', [RoleController::class, 'update']);
            Route::post('role/edit_permission', [RoleController::class, 'editPermission']);
            Route::post('role/delete', [RoleController::class, 'delete']);

            Route::get('permission/index', [PermissionController::class, 'index']);
            Route::post('permission/add', [PermissionController::class, 'add']);
            Route::post('permission/edit', [PermissionController::class, 'update']);
            Route::post('permission/delete', [PermissionController::class, 'delete']);
        });

        Route::prefix('config')->group(function () {
            // 获取常规配置页面数据
            Route::post('get_convention_data', [ConfigureController::class, 'getConventionData']);
            // 更新常规配置
            Route::post('convention_form_submit', [ConfigureController::class, 'conventionFormSubmit']);
            // 获取产品提成设置页面数据
            Route::post('get_product_commission_data', [ConfigureController::class, 'getProductCommissionData']);
            // 产品提成设置表单提交
            Route::post('product_class_product_form_submit', [ConfigureController::class, 'productClassProductFormSubmit']);
        });

        Route::prefix('order')->group(function () {
            // 获取订单列表分页页面数据
            Route::get('get_order_page_list_data', [OrderController::class, 'getOrderPageListData']);
            // 获取订单详情页面数据
            Route::get('get_order_detail_data', [OrderController::class, 'getOrderDetailData']);
        });

        Route::prefix('users')->group(function () {
            // 获取用户列表页面数据
            Route::post('get_users_list_data', [UsersController::class, 'getUsersListData']);
            // 获取用户详情
            Route::post('get_users_info_data', [UsersController::class, 'getUsersInfoData']);
            // 搜索获取用户信息列表
            Route::post('get_users_search_list_data', [UsersController::class, 'getUsersSearchListData']);
            // 用户表单提交
            Route::post('users_form_submit', [UsersController::class, 'usersFormSubmit']);
            // 获取用户提现记录列表页面数据
            Route::post('get_users_withdraw_list_data', [UsersController::class, 'getUsersWithdrawListData']);
            // 用户提现记录驳回提交
            Route::post('users_withdraw_reject_submit', [UsersController::class, 'usersWithdrawRejectSubmit']);
            // 打款用户提交
            Route::post('users_withdraw_pay_submit', [UsersController::class, 'usersWithdrawPaySubmit']);
            // 获取用户实名认证列表页面数据
            Route::post('get_users_realname_list_data', [UsersController::class, 'getUsersRealNameListData']);
            // 用户实名认证审核提交
            Route::post('users_realname_audit_submit', [UsersController::class, 'usersRealNameAuditSubmit']);
        });

        Route::prefix('product')->group(function () {
            // 获取产品列表页面数据
            Route::post('get_product_list_data', [ProductController::class, 'getProductListData']);
            // 删除产品提交
            Route::post('product_delete_submit', [ProductController::class, 'productDeleteSubmit']);
            // 获取产品表单表单数据
            Route::post('get_product_form_data', [ProductController::class, 'getProductFormData']);
            // 产品表单添加Table数据
            Route::post('product_form_add_table_data', [ProductController::class, 'productFormAddTableData']);
            // 产品表单选择上线平台自动生成产品名称
            Route::post('product_form_get_platform_name', [ProductController::class, 'productFormGetPlatformName']);
            // 产品表单数据提交
            Route::post('product_form_submit', [ProductController::class, 'productFormSubmit']);
            // 获取产品分类列表页面数据
            Route::post('get_product_class_list_data', [ProductController::class, 'getProductClassListData']);
            // 删除产品分类
            Route::post('product_class_delete_submit', [ProductController::class, 'productClassDeleteSubmit']);
            // 获取产品分类表单数据
            Route::post('get_product_class_form_data', [ProductController::class, 'getProductClassFormData']);
            // 产品分类表单数据提交
            Route::post('product_class_form_submit', [ProductController::class, 'productClassFormSubmit']);
            // 产品上下架表单提交
            Route::post('product_status_form_submit', [ProductController::class, 'productStatusFormSubmit']);
            // 产品权重表单提交
            Route::post('product_weight_form_submit', [ProductController::class, 'productWeightFormSubmit']);
        });

        Route::prefix('record')->group(function() {
            // 获取收益记录页面数据
            Route::get('get_income_list_data', [RecordController::class, 'getIncomeListData']);
        });

        Route::prefix('news')->group(function () {
            // 获取消息模版列表页面数据
            Route::post('get_news_template_list_data', [NewsController::class, 'getNewsTmplateListData']);
            // 获取消息模版详细页面数据
            Route::post('get_news_template_info_data', [NewsController::class, 'getNewsTmplateInfoData']);
            // 消息模版删除表单提交
            Route::post('news_template_delete_submit', [NewsController::class, 'newsTemplateDeleteSubmit']);
            // 获取消息模版表单数据
            Route::post('get_news_template_form_data', [NewsController::class, 'getNewsTmplateFormData']);
            // 消息模版表单提交
            Route::post('news_template_form_submit', [NewsController::class, 'newsTmplateFormSubmit']);
        });

        Route::prefix('mount_course')->group(function () {
            // 获取挂载教程列表页面数据
            Route::get('get_mount_course_list_data', [MountCourseController::class, 'getMountCourseListData']);
            // 删除挂载教程表单提交
            Route::post('mount_course_delete_submit', [MountCourseController::class, 'mountCourseDeleteSubmit']);
            // 获取挂载教程表单数据
            Route::post('get_mount_course_form_data', [MountCourseController::class, 'getMountCourseFormData']);
            // 挂载教程表单提交
            Route::post('mount_course_form_submit', [MountCourseController::class, 'mountCourseFormSubmit']);
        });

    });

});
/***************************************** 后端--end ****************************************/


/***************************************** 小程序--start ****************************************/
Route::prefix('applet')->group(function () {
    // 获取微信头像
    Route::post('get_user_avatar', [\App\Http\Controllers\wechat\applet\LoginController::class, 'getUserAvatar']);
    // 发送验证码
    Route::post('captcha', [\App\Http\Controllers\wechat\applet\LoginController::class, 'sendCaptcha']);
    // 注册提交
    Route::post('register_submit', [\App\Http\Controllers\wechat\applet\LoginController::class, 'register_submit']);
    // 密码登录提交
    Route::post('password_login_submit', [\App\Http\Controllers\wechat\applet\LoginController::class, 'passwordLoginSubmit']);
    // 登录提交
    Route::post('captcha_login_submit', [\App\Http\Controllers\wechat\applet\LoginController::class, 'captchaLoginSubmit']);
    // 忘记密码
    Route::post('forget_password', [\App\Http\Controllers\wechat\applet\LoginController::class, 'forgetPassword']);
});


// 获取首页产品列表页面数据
Route::get('product/get_home_product_list_data', [\App\Http\Controllers\wechat\product\ProductController::class, 'getHomeProductListData']);
Route::middleware('auth.token')->group(function () {

    // 获取挂载教程列表
    Route::get('mount/get_mount_course_list', [\App\Http\Controllers\wechat\product\MountController::class, 'getMountCourseList']);
    // 获取挂载教程详情
    Route::get('mount/get_mount_course_detail', [\App\Http\Controllers\wechat\product\MountController::class, 'getMountCourseDetail']);

    // 获取新闻列表
    Route::get('news/get_news_list', [\App\Http\Controllers\wechat\notice\NewsController::class, 'getNewsList']);
    // 删除新闻列表
    Route::post('news/delete_news', [\App\Http\Controllers\wechat\notice\NewsController::class, 'deleteNews']);
    // 获取新闻详情
    Route::get('news/get_news_detail', [\App\Http\Controllers\wechat\notice\NewsController::class, 'getNewsDetail']);

    Route::prefix('customer_service')->group(function () {
        // 获取客服二维码
        Route::get('get_customer_service_qrcode', [\App\Http\Controllers\wechat\single\CustomerServiceController::class, 'getCustomerServiceQrcode']);
        // 获取金额之间区别页面数据
        Route::get('get_amount_difference_data', [\App\Http\Controllers\wechat\single\CustomerServiceController::class, 'getAmountDifferenceData']);
        // 获取提现规则数据成功
        Route::get('get_withdrawal_rules_data', [\App\Http\Controllers\wechat\single\CustomerServiceController::class, 'getWithdrawalRulesData']);
        // 获取实名认证服务协议页面数据
        Route::get('get_real_name_agreement_data', [\App\Http\Controllers\wechat\single\CustomerServiceController::class, 'getRealNameAgreementData']);
    });

    // 用户
    Route::prefix('users')->group(function () {
        // 获取首页用户系统页面数据
        Route::post('get_home_user_system_data', [\App\Http\Controllers\wechat\users\UsersController::class, 'getHomeUserSystemData']);
        // 获取用户信息
        Route::post('get_user_info_data', [\App\Http\Controllers\wechat\users\UsersController::class, 'getUserInfoData']);
        // 获取用户详细信息
        Route::post('get_user_detail_data', [\App\Http\Controllers\wechat\users\UsersController::class, 'getUserDetailData']);
        // 小程序推出登录
        Route::post('wechat_logout', [\App\Http\Controllers\wechat\applet\LoginController::class, 'wechatLogout']);
        // 获取用户设置
        Route::post('get_user_setting_data', [\App\Http\Controllers\wechat\users\UsersController::class, 'getUserSettingData']);
        // 用户开关设置
        Route::post('set_user_switch', [\App\Http\Controllers\wechat\users\UsersController::class, 'setUserSwitch']);
        // 用户设置表单提交
        Route::post('user_setting_submit', [\App\Http\Controllers\wechat\users\UsersController::class, 'userSettingSubmit']);
        // 获取注销账号页面数据;
        Route::post('get_cancel_account_data', [\App\Http\Controllers\wechat\users\UsersController::class, 'getCancelAccountData']);
        // 确定注销账号提交
        Route::post('cancel_account_submit', [\App\Http\Controllers\wechat\users\UsersController::class, 'cancelAccountSubmit']);
        // 实名认证表单提交
        Route::post('user_authentication_submit', [\App\Http\Controllers\wechat\users\UsersController::class, 'userAuthenticationSubmit']);
        // 用户提现表单提交
        Route::post('withdraw_submit', [\App\Http\Controllers\wechat\users\UsersController::class, 'userWithdrawSubmit']);
        // 获取体现提交成功页面数据
        Route::get('get_withdraw_success_data', [\App\Http\Controllers\wechat\users\UsersController::class, 'getWithdrawSuccessData']);
        // 获取用户收益明细页面数据
        Route::post('get_user_income_data', [\App\Http\Controllers\wechat\users\UsersController::class, 'getUserIncomeData']);
        // 产品详情页弹窗已观看
        Route::post('product_detail_popup_watch', [\App\Http\Controllers\wechat\users\UsersController::class, 'productDetailPopupWatch']);
    });

    // 产品
    Route::prefix('product')->group(function () {
        // 获取产品广场页面数据
        Route::get('get_product_square_data', [\App\Http\Controllers\wechat\product\ProductController::class, 'getProductSquareData']);
        // 获取产品详情产品介绍页面数据
        Route::get('get_product_detail_introduce_data', [\App\Http\Controllers\wechat\product\ProductController::class, 'getProductDetailIntroduceData']);
        // 获取产品详情页面数据
        Route::get('get_product_detail_data', [\App\Http\Controllers\wechat\product\ProductController::class, 'getProductDetailData']);
        // 获取产品介绍列表页面数据
        Route::get('get_product_introduce_list_data', [\App\Http\Controllers\wechat\product\ProductController::class, 'getProductIntroduceListData']);
    });

    // 数据统计
    Route::prefix('statistics')->group(function () {
        // 获取数据统计页面数据
        Route::post('get_data_center_new_data', [\App\Http\Controllers\wechat\users\StatisticsController::class, 'getDataCenterNewData']);
    });

    // 等级
    Route::prefix('level')->group(function () {
        // 获取等级区别页面数据
        Route::get('get_level_difference_data', [\App\Http\Controllers\wechat\users\LevelController::class, 'getLevelDifferenceData']);
    });

});
/***************************************** 小程序--end ****************************************/



/***************************************** webPage--end ****************************************/
// 获取登录微信二维码信息
Route::post('web/applet/get_wechat_qrcode_data', [App\Http\Controllers\web\LoginController::class, 'getWechatQrcodeData']);
// 微信二维码扫码登录回调处理
Route::post('web/applet/get_login_wechat_handle', [App\Http\Controllers\web\LoginController::class, 'getLoginWechatHandle']);
// 密码登录提交
Route::post('web/applet/password_login_submit', [App\Http\Controllers\web\LoginController::class, 'passwordLoginSubmit']);
// 验证码登录提交
Route::post('web/applet/captcha_login_submit', [App\Http\Controllers\web\LoginController::class, 'captchaLoginSubmit']);

Route::prefix('web')->middleware('web.token')->group(function () {

    // 获取用户信息
    Route::post('users/get_user_info', [App\Http\Controllers\web\UsersController::class, 'getUserInfoData']);
    // 获取用户详细信息
    Route::post('users/get_user_detail_info', [App\Http\Controllers\web\UsersController::class, 'getUserDetailInfo']);
    // 获取收款账户页面数据
    Route::post('users/get_account_number_data', [App\Http\Controllers\web\UsersController::class, 'getAccountNumberData']);
    // 收款账户表单提交
    Route::post('users/payment_account_submit', [App\Http\Controllers\web\UsersController::class, 'paymentAccountSubmit']);
    // 实名认证表单提交
    Route::post('users/user_authentication_submit', [\App\Http\Controllers\web\UsersController::class, 'userAuthenticationSubmit']);
    // 注销账号表单提交
    Route::post('users/cancel_account_submit', [App\Http\Controllers\web\UsersController::class, 'cancelAccountSubmit']);

    // 获取广场列表页面数据
    Route::post('square/get_square_list_data', [App\Http\Controllers\web\ProductController::class, 'getSquareListData']);
    // 获取广场产品介绍数据
    Route::post('square/get_square_introduce_data', [App\Http\Controllers\web\ProductController::class, 'getSquareIntroduceData']);

    // 获取数据中心（产品数据）页面数据
    Route::post('statistics/get_datacenter_data', [App\Http\Controllers\web\StatisticsController::class, 'getDataCenterData']);
    // 获取数据中心（收益数据）页面数据
    Route::post('statistics/get_datacenter_income_data', [App\Http\Controllers\web\StatisticsController::class, 'getDataCenterIncomeData']);

    // 获取财务页面数据
    Route::post('finance/get_withdraw_data', [App\Http\Controllers\web\FinanceController::class, 'getWithdrawData']);
    // 财务提现表单提交
    Route::post('finance/withdraw_apply_submit', [App\Http\Controllers\web\FinanceController::class, 'userWithdrawSubmit']);
    // 获取用户收益明细页面数据
    Route::post('finance/get_user_income_data', [App\Http\Controllers\web\FinanceController::class, 'getUserIncomeData']);
});
/***************************************** webPage--end ****************************************/



/***************************************** Api--start ****************************************/
Route::middleware('api.oauth')->group(function () {
    // Api分销注册
    Route::post('applet/register', [\App\Http\Controllers\api\AuthorizationController::class, 'apiRegister']);
    // Api获取用户信息
    Route::post('users/get_agent_info', [\App\Http\Controllers\api\AgentController::class, 'getAgentInfo']);
    // Api更新订单状态
    Route::post('order/update_order_status', [App\Http\Controllers\api\OrderController::class, 'updateOrderStatus']);
});
/***************************************** Api--end ****************************************/



Route::post('test', [\App\Http\Controllers\api\TestController::class, 'test']);
